package com.ls.task.dal.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ls.fw.data.annotation.FwColumn;
import com.ls.fw.data.annotation.FwTable;
import com.ls.fw.data.bean.BaseColumns;
import com.ls.fw.data.bean.BaseDataEntity;
import com.ls.fw.data.bean.ColumnItem;
import com.ls.fw.data.converter.CustomDateSerializer;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.*;
import org.springframework.format.annotation.DateTimeFormat;

@Table(name = "sys_task")
@FwTable(name = "sys_task",remark = "")
public class SysTask extends BaseDataEntity implements Serializable {
    /**
     * ID
     */
    @Id
    @FwColumn(name = "id",remark = "ID")
    @GeneratedValue(generator = "JDBC")
    private Long id;

    /**
     * 名称
     */
    @FwColumn(name = "name",remark = "名称")
    private String name;

    /**
     * 曾用名
     */
    @Column(name = "old_name")
    @FwColumn(name = "old_name",remark = "曾用名")
    private String oldName;

    /**
     * 编号
     */
    @FwColumn(name = "num",remark = "编号")
    private String num;

    /**
     * 上级
     */
    @Column(name = "p_id")
    @FwColumn(name = "p_id",remark = "上级")
    private Long pId;

    /**
     * 级别
     */
    @FwColumn(name = "level",remark = "级别")
    private Integer level;

    @FwColumn(name = "checked",remark = "")
    private Boolean checked;

    /**
     * 排序序号
     */
    @Column(name = "order_num")
    @FwColumn(name = "order_num",remark = "排序序号")
    private Integer orderNum;

    /**
     * 任务分组
     */
    @Column(name = "group_name")
    @FwColumn(name = "group_name",remark = "任务分组")
    private String groupName;

    /**
     * 描述
     */
    @FwColumn(name = "description",remark = "描述")
    private String description;

    /**
     * 任务调用类在spring中注册的bean id
     */
    @Column(name = "spring_id")
    @FwColumn(name = "spring_id",remark = "任务调用类在spring中注册的bean id")
    private String springId;

    /**
     * 任务调用类名，包名+类名
     */
    @Column(name = "job_class")
    @FwColumn(name = "job_class",remark = "任务调用类名，包名+类名")
    private String jobClass;

    @Column(name = "method_name")
    @FwColumn(name = "method_name",remark = "")
    private String methodName;

    /**
     * 启动时间
     */
    @Column(name = "start_dt")
    @FwColumn(name = "start_dt",remark = "启动时间")
    private Date startDt;

    /**
     * 停止时间
     */
    @Column(name = "end_dt")
    @FwColumn(name = "end_dt",remark = "停止时间")
    private Date endDt;

    /**
     * 任务url
     */
    @FwColumn(name = "url",remark = "任务url")
    private String url;

    /**
     * 是否为链接
     */
    @Column(name = "url_class")
    @FwColumn(name = "url_class",remark = "是否为链接")
    private Boolean urlClass;

    /**
     * 状态code
     */
    @Column(name = "status_code")
    @FwColumn(name = "status_code",remark = "状态code")
    private String statusCode;

    /**
     * 状态
     */
    @Column(name = "status_name")
    @FwColumn(name = "status_name",remark = "状态")
    private String statusName;

    /**
     * 是否同步
     */
    @FwColumn(name = "concurrent",remark = "是否同步")
    private Boolean concurrent;

    /**
     * 英文名称
     */
    @Column(name = "name_en")
    @FwColumn(name = "name_en",remark = "英文名称")
    private String nameEn;

    private static final long serialVersionUID = 1L;

    /**
     * 获取ID
     *
     * @return id - ID
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置ID
     *
     * @param id ID
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 获取名称
     *
     * @return name - 名称
     */
    public String getName() {
        return name;
    }

    /**
     * 设置名称
     *
     * @param name 名称
     */
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    /**
     * 获取曾用名
     *
     * @return old_name - 曾用名
     */
    public String getOldName() {
        return oldName;
    }

    /**
     * 设置曾用名
     *
     * @param oldName 曾用名
     */
    public void setOldName(String oldName) {
        this.oldName = oldName == null ? null : oldName.trim();
    }

    /**
     * 获取编号
     *
     * @return num - 编号
     */
    public String getNum() {
        return num;
    }

    /**
     * 设置编号
     *
     * @param num 编号
     */
    public void setNum(String num) {
        this.num = num == null ? null : num.trim();
    }

    /**
     * 获取上级
     *
     * @return p_id - 上级
     */
    public Long getpId() {
        return pId;
    }

    /**
     * 设置上级
     *
     * @param pId 上级
     */
    public void setpId(Long pId) {
        this.pId = pId;
    }

    /**
     * 获取级别
     *
     * @return level - 级别
     */
    public Integer getLevel() {
        return level;
    }

    /**
     * 设置级别
     *
     * @param level 级别
     */
    public void setLevel(Integer level) {
        this.level = level;
    }

    /**
     * @return checked
     */
    public Boolean getChecked() {
        return checked;
    }

    /**
     * @param checked
     */
    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    /**
     * 获取排序序号
     *
     * @return order_num - 排序序号
     */
    public Integer getOrderNum() {
        return orderNum;
    }

    /**
     * 设置排序序号
     *
     * @param orderNum 排序序号
     */
    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    /**
     * 获取任务分组
     *
     * @return group_name - 任务分组
     */
    public String getGroupName() {
        return groupName;
    }

    /**
     * 设置任务分组
     *
     * @param groupName 任务分组
     */
    public void setGroupName(String groupName) {
        this.groupName = groupName == null ? null : groupName.trim();
    }

    /**
     * 获取描述
     *
     * @return description - 描述
     */
    public String getDescription() {
        return description;
    }

    /**
     * 设置描述
     *
     * @param description 描述
     */
    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }

    /**
     * 获取任务调用类在spring中注册的bean id
     *
     * @return spring_id - 任务调用类在spring中注册的bean id
     */
    public String getSpringId() {
        return springId;
    }

    /**
     * 设置任务调用类在spring中注册的bean id
     *
     * @param springId 任务调用类在spring中注册的bean id
     */
    public void setSpringId(String springId) {
        this.springId = springId == null ? null : springId.trim();
    }

    /**
     * 获取任务调用类名，包名+类名
     *
     * @return job_class - 任务调用类名，包名+类名
     */
    public String getJobClass() {
        return jobClass;
    }

    /**
     * 设置任务调用类名，包名+类名
     *
     * @param jobClass 任务调用类名，包名+类名
     */
    public void setJobClass(String jobClass) {
        this.jobClass = jobClass == null ? null : jobClass.trim();
    }

    /**
     * @return method_name
     */
    public String getMethodName() {
        return methodName;
    }

    /**
     * @param methodName
     */
    public void setMethodName(String methodName) {
        this.methodName = methodName == null ? null : methodName.trim();
    }

    /**
     * 获取启动时间
     *
     * @return start_dt - 启动时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonSerialize(using=CustomDateSerializer.class)
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    public Date getStartDt() {
        return startDt;
    }

    /**
     * 设置启动时间
     *
     * @param startDt 启动时间
     */
    public void setStartDt(Date startDt) {
        this.startDt = startDt;
    }

    /**
     * 获取停止时间
     *
     * @return end_dt - 停止时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonSerialize(using=CustomDateSerializer.class)
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    public Date getEndDt() {
        return endDt;
    }

    /**
     * 设置停止时间
     *
     * @param endDt 停止时间
     */
    public void setEndDt(Date endDt) {
        this.endDt = endDt;
    }

    /**
     * 获取任务url
     *
     * @return url - 任务url
     */
    public String getUrl() {
        return url;
    }

    /**
     * 设置任务url
     *
     * @param url 任务url
     */
    public void setUrl(String url) {
        this.url = url == null ? null : url.trim();
    }

    /**
     * 获取是否为链接
     *
     * @return url_class - 是否为链接
     */
    public Boolean getUrlClass() {
        return urlClass;
    }

    /**
     * 设置是否为链接
     *
     * @param urlClass 是否为链接
     */
    public void setUrlClass(Boolean urlClass) {
        this.urlClass = urlClass;
    }

    /**
     * 获取状态code
     *
     * @return status_code - 状态code
     */
    public String getStatusCode() {
        return statusCode;
    }

    /**
     * 设置状态code
     *
     * @param statusCode 状态code
     */
    public void setStatusCode(String statusCode) {
        this.statusCode = statusCode == null ? null : statusCode.trim();
    }

    /**
     * 获取状态
     *
     * @return status_name - 状态
     */
    public String getStatusName() {
        return statusName;
    }

    /**
     * 设置状态
     *
     * @param statusName 状态
     */
    public void setStatusName(String statusName) {
        this.statusName = statusName == null ? null : statusName.trim();
    }

    /**
     * 获取是否同步
     *
     * @return concurrent - 是否同步
     */
    public Boolean getConcurrent() {
        return concurrent;
    }

    /**
     * 设置是否同步
     *
     * @param concurrent 是否同步
     */
    public void setConcurrent(Boolean concurrent) {
        this.concurrent = concurrent;
    }

    /**
     * 获取英文名称
     *
     * @return name_en - 英文名称
     */
    public String getNameEn() {
        return nameEn;
    }

    /**
     * 设置英文名称
     *
     * @param nameEn 英文名称
     */
    public void setNameEn(String nameEn) {
        this.nameEn = nameEn == null ? null : nameEn.trim();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SysTask other = (SysTask) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getOldName() == null ? other.getOldName() == null : this.getOldName().equals(other.getOldName()))
            && (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum()))
            && (this.getpId() == null ? other.getpId() == null : this.getpId().equals(other.getpId()))
            && (this.getLevel() == null ? other.getLevel() == null : this.getLevel().equals(other.getLevel()))
            && (this.getChecked() == null ? other.getChecked() == null : this.getChecked().equals(other.getChecked()))
            && (this.getModUser() == null ? other.getModUser() == null : this.getModUser().equals(other.getModUser()))
            && (this.getModUserId() == null ? other.getModUserId() == null : this.getModUserId().equals(other.getModUserId()))
            && (this.getModDt() == null ? other.getModDt() == null : this.getModDt().equals(other.getModDt()))
            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
            && (this.getCreateUserId() == null ? other.getCreateUserId() == null : this.getCreateUserId().equals(other.getCreateUserId()))
            && (this.getCreateDt() == null ? other.getCreateDt() == null : this.getCreateDt().equals(other.getCreateDt()))
            && (this.getDeleteClass() == null ? other.getDeleteClass() == null : this.getDeleteClass().equals(other.getDeleteClass()))
            && (this.getValidClass() == null ? other.getValidClass() == null : this.getValidClass().equals(other.getValidClass()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getUpdateTs() == null ? other.getUpdateTs() == null : this.getUpdateTs().equals(other.getUpdateTs()))
            && (this.getInsertTs() == null ? other.getInsertTs() == null : this.getInsertTs().equals(other.getInsertTs()))
            && (this.getCanUpdate() == null ? other.getCanUpdate() == null : this.getCanUpdate().equals(other.getCanUpdate()))
            && (this.getCanDelete() == null ? other.getCanDelete() == null : this.getCanDelete().equals(other.getCanDelete()))
            && (this.getOrderNum() == null ? other.getOrderNum() == null : this.getOrderNum().equals(other.getOrderNum()))
            && (this.getGroupName() == null ? other.getGroupName() == null : this.getGroupName().equals(other.getGroupName()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getSpringId() == null ? other.getSpringId() == null : this.getSpringId().equals(other.getSpringId()))
            && (this.getJobClass() == null ? other.getJobClass() == null : this.getJobClass().equals(other.getJobClass()))
            && (this.getMethodName() == null ? other.getMethodName() == null : this.getMethodName().equals(other.getMethodName()))
            && (this.getStartDt() == null ? other.getStartDt() == null : this.getStartDt().equals(other.getStartDt()))
            && (this.getEndDt() == null ? other.getEndDt() == null : this.getEndDt().equals(other.getEndDt()))
            && (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
            && (this.getUrlClass() == null ? other.getUrlClass() == null : this.getUrlClass().equals(other.getUrlClass()))
            && (this.getStatusCode() == null ? other.getStatusCode() == null : this.getStatusCode().equals(other.getStatusCode()))
            && (this.getStatusName() == null ? other.getStatusName() == null : this.getStatusName().equals(other.getStatusName()))
            && (this.getConcurrent() == null ? other.getConcurrent() == null : this.getConcurrent().equals(other.getConcurrent()))
            && (this.getNameEn() == null ? other.getNameEn() == null : this.getNameEn().equals(other.getNameEn()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getOldName() == null) ? 0 : getOldName().hashCode());
        result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode());
        result = prime * result + ((getpId() == null) ? 0 : getpId().hashCode());
        result = prime * result + ((getLevel() == null) ? 0 : getLevel().hashCode());
        result = prime * result + ((getChecked() == null) ? 0 : getChecked().hashCode());
        result = prime * result + ((getModUser() == null) ? 0 : getModUser().hashCode());
        result = prime * result + ((getModUserId() == null) ? 0 : getModUserId().hashCode());
        result = prime * result + ((getModDt() == null) ? 0 : getModDt().hashCode());
        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
        result = prime * result + ((getCreateUserId() == null) ? 0 : getCreateUserId().hashCode());
        result = prime * result + ((getCreateDt() == null) ? 0 : getCreateDt().hashCode());
        result = prime * result + ((getDeleteClass() == null) ? 0 : getDeleteClass().hashCode());
        result = prime * result + ((getValidClass() == null) ? 0 : getValidClass().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getUpdateTs() == null) ? 0 : getUpdateTs().hashCode());
        result = prime * result + ((getInsertTs() == null) ? 0 : getInsertTs().hashCode());
        result = prime * result + ((getCanUpdate() == null) ? 0 : getCanUpdate().hashCode());
        result = prime * result + ((getCanDelete() == null) ? 0 : getCanDelete().hashCode());
        result = prime * result + ((getOrderNum() == null) ? 0 : getOrderNum().hashCode());
        result = prime * result + ((getGroupName() == null) ? 0 : getGroupName().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getSpringId() == null) ? 0 : getSpringId().hashCode());
        result = prime * result + ((getJobClass() == null) ? 0 : getJobClass().hashCode());
        result = prime * result + ((getMethodName() == null) ? 0 : getMethodName().hashCode());
        result = prime * result + ((getStartDt() == null) ? 0 : getStartDt().hashCode());
        result = prime * result + ((getEndDt() == null) ? 0 : getEndDt().hashCode());
        result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
        result = prime * result + ((getUrlClass() == null) ? 0 : getUrlClass().hashCode());
        result = prime * result + ((getStatusCode() == null) ? 0 : getStatusCode().hashCode());
        result = prime * result + ((getStatusName() == null) ? 0 : getStatusName().hashCode());
        result = prime * result + ((getConcurrent() == null) ? 0 : getConcurrent().hashCode());
        result = prime * result + ((getNameEn() == null) ? 0 : getNameEn().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(","+super.toString());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", oldName=").append(oldName);
        sb.append(", num=").append(num);
        sb.append(", pId=").append(pId);
        sb.append(", level=").append(level);
        sb.append(", checked=").append(checked);
        sb.append(", orderNum=").append(orderNum);
        sb.append(", groupName=").append(groupName);
        sb.append(", description=").append(description);
        sb.append(", springId=").append(springId);
        sb.append(", jobClass=").append(jobClass);
        sb.append(", methodName=").append(methodName);
        sb.append(", startDt=").append(startDt);
        sb.append(", endDt=").append(endDt);
        sb.append(", url=").append(url);
        sb.append(", urlClass=").append(urlClass);
        sb.append(", statusCode=").append(statusCode);
        sb.append(", statusName=").append(statusName);
        sb.append(", concurrent=").append(concurrent);
        sb.append(", nameEn=").append(nameEn);
        sb.append("]");
        return sb.toString();
    }

    /*************数据库列名start***********/
    /*************数据库列名end***********/
    public static final class Columns extends BaseColumns {
        /**
         * 字段名称映射<数据库字段名,属性名>
         */
        public static final Map<String, String> FIELD_MAP =  new HashMap<String,String>();

        /**
         * ID
         */
        public static final ColumnItem id = new ColumnItem("id","id");

        /**
         * 主键名称
         */
        public static final ColumnItem PK = new ColumnItem("id","id");

        /**
         * 名称
         */
        public static final ColumnItem name = new ColumnItem("name","name");

        /**
         * 曾用名
         */
        public static final ColumnItem oldName = new ColumnItem("old_name","oldName");

        /**
         * 编号
         */
        public static final ColumnItem num = new ColumnItem("num","num");

        /**
         * 上级
         */
        public static final ColumnItem pId = new ColumnItem("p_id","pId");

        /**
         * 级别
         */
        public static final ColumnItem level = new ColumnItem("level","level");

        public static final ColumnItem checked = new ColumnItem("checked","checked");

        /**
         * 修改人
         */
        public static final ColumnItem modUser = new ColumnItem("mod_user","modUser");

        /**
         * 修改人ID
         */
        public static final ColumnItem modUserId = new ColumnItem("mod_user_id","modUserId");

        /**
         * 修改时间
         */
        public static final ColumnItem modDt = new ColumnItem("mod_dt","modDt");

        /**
         * 创建人
         */
        public static final ColumnItem createUser = new ColumnItem("create_user","createUser");

        /**
         * 创建人ID
         */
        public static final ColumnItem createUserId = new ColumnItem("create_user_id","createUserId");

        /**
         * 创建时间
         */
        public static final ColumnItem createDt = new ColumnItem("create_dt","createDt");

        /**
         * 删除区分
         */
        public static final ColumnItem deleteClass = new ColumnItem("delete_class","deleteClass");

        /**
         * 有效区分
         */
        public static final ColumnItem validClass = new ColumnItem("valid_class","validClass");

        /**
         * 备注
         */
        public static final ColumnItem remark = new ColumnItem("remark","remark");

        public static final ColumnItem updateTs = new ColumnItem("update_ts","updateTs");

        /**
         * 时间戳
         */
        public static final ColumnItem insertTs = new ColumnItem("insert_ts","insertTs");

        /**
         * 是否能更新
         */
        public static final ColumnItem canUpdate = new ColumnItem("can_update","canUpdate");

        /**
         * 是否能删除
         */
        public static final ColumnItem canDelete = new ColumnItem("can_delete","canDelete");

        /**
         * 排序序号
         */
        public static final ColumnItem orderNum = new ColumnItem("order_num","orderNum");

        /**
         * 任务分组
         */
        public static final ColumnItem groupName = new ColumnItem("group_name","groupName");

        /**
         * 描述
         */
        public static final ColumnItem description = new ColumnItem("description","description");

        /**
         * 任务调用类在spring中注册的bean id
         */
        public static final ColumnItem springId = new ColumnItem("spring_id","springId");

        /**
         * 任务调用类名，包名+类名
         */
        public static final ColumnItem jobClass = new ColumnItem("job_class","jobClass");

        public static final ColumnItem methodName = new ColumnItem("method_name","methodName");

        /**
         * 启动时间
         */
        public static final ColumnItem startDt = new ColumnItem("start_dt","startDt");

        /**
         * 停止时间
         */
        public static final ColumnItem endDt = new ColumnItem("end_dt","endDt");

        /**
         * 任务url
         */
        public static final ColumnItem url = new ColumnItem("url","url");

        /**
         * 是否为链接
         */
        public static final ColumnItem urlClass = new ColumnItem("url_class","urlClass");

        /**
         * 状态code
         */
        public static final ColumnItem statusCode = new ColumnItem("status_code","statusCode");

        /**
         * 状态
         */
        public static final ColumnItem statusName = new ColumnItem("status_name","statusName");

        /**
         * 是否同步
         */
        public static final ColumnItem concurrent = new ColumnItem("concurrent","concurrent");

        /**
         * 英文名称
         */
        public static final ColumnItem nameEn = new ColumnItem("name_en","nameEn");

        static {
            FIELD_MAP.put("id","id");
            FIELD_MAP.put("name","name");
            FIELD_MAP.put("old_name","oldName");
            FIELD_MAP.put("num","num");
            FIELD_MAP.put("p_id","pId");
            FIELD_MAP.put("level","level");
            FIELD_MAP.put("checked","checked");
            FIELD_MAP.put("mod_user","modUser");
            FIELD_MAP.put("mod_user_id","modUserId");
            FIELD_MAP.put("mod_dt","modDt");
            FIELD_MAP.put("create_user","createUser");
            FIELD_MAP.put("create_user_id","createUserId");
            FIELD_MAP.put("create_dt","createDt");
            FIELD_MAP.put("delete_class","deleteClass");
            FIELD_MAP.put("valid_class","validClass");
            FIELD_MAP.put("remark","remark");
            FIELD_MAP.put("update_ts","updateTs");
            FIELD_MAP.put("insert_ts","insertTs");
            FIELD_MAP.put("can_update","canUpdate");
            FIELD_MAP.put("can_delete","canDelete");
            FIELD_MAP.put("order_num","orderNum");
            FIELD_MAP.put("group_name","groupName");
            FIELD_MAP.put("description","description");
            FIELD_MAP.put("spring_id","springId");
            FIELD_MAP.put("job_class","jobClass");
            FIELD_MAP.put("method_name","methodName");
            FIELD_MAP.put("start_dt","startDt");
            FIELD_MAP.put("end_dt","endDt");
            FIELD_MAP.put("url","url");
            FIELD_MAP.put("url_class","urlClass");
            FIELD_MAP.put("status_code","statusCode");
            FIELD_MAP.put("status_name","statusName");
            FIELD_MAP.put("concurrent","concurrent");
            FIELD_MAP.put("name_en","nameEn");
        }
    }
}